from selenium import webdriver
from selenium.webdriver.common.by import By

class Client:
    def __init__(self):
        self.wd = webdriver.Chrome()
        self.wd.get("http://172.16.60.131/")
        self.wd.maximize_window()
        self.wd.implicitly_wait(10)


    def action(self, element, **kwargs):
        ac = kwargs.get('act')
        if ac == "send_keys":
            self.wd.find_element(*element).send_keys(kwargs.get('value'))
        elif ac == "click":
            self.wd.find_element(*element).click()


if __name__ == "__main__":
    client = Client()
    client.action((By.XPATH, "//../span[text() = '用户中心登录']"), act = "click")
    # wd.find_element_by_xpath("//../span[text() = '用户中心登录']").click()
    #
    # # 输入邮箱
    # wd.find_element_by_xpath("//input[@placeholder= '邮箱']").send_keys(username)
    #
    # # 输入密码
    # wd.find_element_by_xpath("//input[@placeholder = '密码']").send_keys(passwd)
    #
    # # 点击“授权并登录”按钮
    # wd.find_element_by_xpath("//span[text() = '授权并登录']").click()